{% extends "base.html" %}
{% load thumbnail %}

{% block title %}Movie Listing{% endblock %}

{% block jscript %}
$(document).ready(function()
    {
        $("#moviesTable").tablesorter();
    }
);
{% endblock %}

{% block content %}
<h2>Listing all movies</h2>
<table id="moviesTable">
    <thead>
    <tr>
        <th></th>
        <th align=left>Title</th>
        <th align=left>Type</th>
        <th align=left>Genre</th>
        <th align=left>Year</th>
    </tr>
    </thead>
    <tbody>
{% for movie in movies %}
    <tr class="{% cycle 'odd' 'even' %}">
        <td><img src="{% thumbnail movie.poster_filename 48x70 %}"></td> 
        <td><a href="{% url movies.views.movie_detail movie_id=movie.id %}">{{ movie.title }}</a></td>
        <td>{{ movie.imdb_kind|truncatewords:"1" }}</td>
        <td>
            {% for genre in movie.genres.all %}
            {{ genre.name }}
            {% endfor %}
        </td>
        <td>{{ movie.year }}</td>
    </tr>
{% endfor %}
    </tbody>
</table>
{% endblock %}
